package web_model

import (
	"github.com/shopspring/decimal"
	"time"

	"gorm.io/gorm"
)

const TableNameTransOrder = "trans_order"

// TransOrder mapped from table <trans_order>
type TransOrder struct {
	ID            int64           `gorm:"column:id;type:INTEGER;primaryKey" json:"id"`
	OrderCode     string          `gorm:"column:order_code;type:TEXT" json:"order_code"`
	CustomerCode  string          `gorm:"column:customer_code;type:TEXT" json:"customer_code"`
	CustomerName  string          `gorm:"column:customer_name;type:TEXT" json:"customer_name"`
	Route         string          `gorm:"column:route;type:TEXT" json:"route"`
	PriorityLevel string          `gorm:"column:priority_level;type:text" json:"priority_level"`
	PackCount     int64           `gorm:"column:pack_count;type:integer" json:"pack_count"`
	TransBillID   int64           `gorm:"column:trans_bill_id;type:INTEGER" json:"trans_bill_id"`
	TransBillSn   string          `gorm:"column:trans_bill_sn;type:TEXT" json:"trans_bill_sn"`
	Status        string          `gorm:"column:status;type:TEXT" json:"status"`
	OrderType     string          `gorm:"column:order_type;type:TEXT" json:"order_type"`
	TransTempType string          `gorm:"column:trans_temp_type;type:TEXT" json:"trans_temp_type"`
	StartTemp     decimal.Decimal `gorm:"column:start_temp;type:decimal(10,2)" json:"start_temp"`
	EndTemp       decimal.Decimal `gorm:"column:end_temp;type:decimal(10,2)" json:"end_temp"`
	Sort          int64           `gorm:"column:sort;type:integer" json:"sort"`
	CreatedAt     time.Time       `gorm:"column:created_at;type:DATETIME" json:"created_at"`
	UpdatedAt     time.Time       `gorm:"column:updated_at;type:DATETIME" json:"updated_at"`
	DeletedAt     gorm.DeletedAt  `gorm:"column:deleted_at;type:DATETIME" json:"deleted_at"`
	CreatedBy     string          `gorm:"column:created_by;type:TEXT" json:"created_by"`
	UpdatedBy     string          `gorm:"column:updated_by;type:text" json:"updated_by"`
}

// TableName TransOrder's table name
func (*TransOrder) TableName() string {
	return TableNameTransOrder
}
